#include<iostream>
#include<cstdio>
using namespace std;
int main(){
    int n=0;
   for(int i=1;i<=2019;i++){
       int temp=i;
       while(temp){
           if(temp%10==9){n++;break;}
           temp/=10;
       }
   }
    cout<<n<<endl;
    return 0;
}
